﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Register.IDAL;
using Register.Model;
using Register.DALFactory;
using Register.Command;

namespace Register.BLL
{
    /// <summary>
    /// FileName: AnnouncementBLL.cs
    /// CLRVersion: 4.0.30319.269
    /// Author: WangKunLun
    /// Corporation: 
    /// Description: 
    /// DateTime: 2012/7/10 23:11:24
    /// </summary>
    public class DoctorWorkDayBLL
    {
        private static String typeNameKey = "IDoctorWorkDayDALKey";

        public static bool AddDoctorWorkDay(Model.DoctorWorkDay model)
        {
            IDoctorWorkDayDAL iDoctorWorkDay = DALFactory<IDoctorWorkDayDAL>.Create(typeNameKey);
            try
            {
                if (iDoctorWorkDay.AddDoctorWorkDay(model) > 0)
                    return true;
                else
                    return false;
            }
            catch (Exception e)
            {
                LogRecordHelper.LogNote("ERROR", e.Message);
                throw e;
            }
        }

        public static List<DoctorInfo> GetDoctorInfo()
        {
            IDoctorWorkDayDAL iDoctorWorkDay = DALFactory<IDoctorWorkDayDAL>.Create(typeNameKey);

            try
            {
                return iDoctorWorkDay.GetDoctorInfo();
            }
            catch (Exception e)
            {
                LogRecordHelper.LogNote("ERROR", e.Message);
                throw e;
            }
        }

        public static bool DeleteDoctorWorkDay(string DoctorWorkDayID)
        {
            IDoctorWorkDayDAL iDoctorWorkDay = DALFactory<IDoctorWorkDayDAL>.Create(typeNameKey);
            try
            {
                if (iDoctorWorkDay.DeleteDoctorWorkDay(DoctorWorkDayID) > 0)
                    return true;
                else
                    return false;
            }
            catch (Exception e)
            {
                LogRecordHelper.LogNote("ERROR", e.Message);
                throw e;
            }
        }


        public static bool UpdateDoctorWorkDay(Model.DoctorWorkDay model)
        {
            IDoctorWorkDayDAL iDoctorWorkDay = DALFactory<IDoctorWorkDayDAL>.Create(typeNameKey);
            try
            {
                if (iDoctorWorkDay.UpdateDoctorWorkDay(model) > 0)
                {
                    return true;
                }
                else
                    return false;
            }
            catch (Exception e)
            {
                LogRecordHelper.LogNote("ERROR", e.Message);
                throw e;
            }
        }

        public static List<Model.DoctorWorkDay> GetPagedDoctorWorkDay(int size, int pageIndex, string where)
        {
            IDoctorWorkDayDAL iDoctorWorkDay = DALFactory<IDoctorWorkDayDAL>.Create(typeNameKey);

            try
            {
                return iDoctorWorkDay.GetPagedDoctorWorkDay(size, pageIndex, where);
            }
            catch (Exception e)
            {
                LogRecordHelper.LogNote("ERROR", e.Message);
                throw e;
            }
        }

        public static Model.DoctorWorkDay GetDoctorWorkDay(string DoctorWorkDay)
        {
            IDoctorWorkDayDAL iDoctorWorkDay = DALFactory<IDoctorWorkDayDAL>.Create(typeNameKey);
            try
            {
                return iDoctorWorkDay.GetDoctorWorkDay(DoctorWorkDay);
            }
            catch (Exception e)
            {
                LogRecordHelper.LogNote("ERROR", e.Message);
                throw e;
            }
        }

        public static List<Model.DoctorWorkDay> GetDepartments_ID(string Departments_ID)
        {
            IDoctorWorkDayDAL iDoctorWorkDay = DALFactory<IDoctorWorkDayDAL>.Create(typeNameKey);

            try
            {
                return iDoctorWorkDay.GetDepartments_ID(Departments_ID);
            }
            catch (Exception e)
            {
                LogRecordHelper.LogNote("ERROR", e.Message);
                throw e;
            }
        }

        public static int GetDoctorWorkDayCount(string where)
        {
            IDoctorWorkDayDAL iDoctorWorkDay = DALFactory<IDoctorWorkDayDAL>.Create(typeNameKey);

            try
            {
                return iDoctorWorkDay.GetDoctorWorkDayCount(where);
            }
            catch (Exception e)
            {
                LogRecordHelper.LogNote("ERROR", e.Message);
                throw e;
            }
        }
    }
}
